// 测试投票参数传递
const testVoteData = {
  selectedAnimals: [
    { villagerId: "阳明", villagerName: "阳明" },
    { villagerId: "阿诚", villagerName: "阿诚" }
  ]
};

console.log('测试投票数据:', testVoteData);

// 模拟云函数参数验证
const { villagerId, villagerName, selectedAnimals } = testVoteData;
const animalsToVote = selectedAnimals || (villagerId && villagerName ? [{ villagerId, villagerName }] : []);

console.log('处理后的投票数据:', animalsToVote);
console.log('参数验证结果:', {
  hasOpenid: true, // 模拟有openid
  animalsToVoteLength: animalsToVote.length,
  isValid: true && animalsToVote.length > 0
});

// 验证数据结构
animalsToVote.forEach((animal, index) => {
  console.log(`动物 ${index + 1}:`, {
    villagerId: animal.villagerId,
    villagerName: animal.villagerName,
    hasRequiredFields: animal.villagerId && animal.villagerName
  });
}); 